package com.bobi.tfca.ui.mainnavigation.home.activity

import android.annotation.SuppressLint
import android.os.Bundle
import androidx.lifecycle.ViewModel
import com.bobi.tfca.base.BaseFragment
import com.bobi.tfca.databinding.FragmentShowActDetailsBinding
import com.bobi.tfca.databinding.FragmentShowActInfoBinding

class ShowActInfoFragment: BaseFragment<FragmentShowActInfoBinding, ViewModel>(
    FragmentShowActInfoBinding::inflate,
    null,
    true
) {
    @SuppressLint("ResourceType", "UseRequireInsteadOfGet")
    override fun initFragment(
        binding: FragmentShowActInfoBinding,
        viewModel: ViewModel?,
        savedInstanceState: Bundle?
    ) {
        // 设置监听viewmodel
        publicViewModel!!.activity.observe(viewLifecycleOwner){
            val signTimeRange = it.signStartTime + "-" + it.signEndTime
            binding.tvSignTimeRange.text = signTimeRange
            val actTimeRange = it.actStartTime + "-" + it.actEndTime
            binding.tvActTimeRange.text = actTimeRange
            binding.tvLocation.text = it.activityPlace
            binding.tvLimitedNum.text = it.limitedNum.toString()
        }
    }
}